#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(0);
    string A, B;
    getline(cin, A);
    getline(cin, B);

    vector<bool> visited(127, false);
    string result;

    for (char c : A) {
        if (!visited[c]) {
            result += c;
            visited[c] = true;
        }
    }

    for (char c : B) {
        if (!visited[c]) {
            result += c;
            visited[c] = true;
        }
    }

    cout << result << endl;

    return 0;
}    